require 'active_support'

class Semaphor::Reports::Base

  class_inheritable_hash :metadata
  self.metadata = {}
  
  def self.method_missing(method, *args)
    if /(.*?)=$/ =~ method.to_s
      metadata[$~[1].intern] = args[0]
    else
      metadata[method]
    end
  end
  
  def self.db
    ActiveRecord::Base.connection
  end
  
  def db
    self.class.db
  end
  
  def self.cols
    
  end
  
  def initialize
    @data = nil
  end
  
  def run
  end
  
  def data
    if @data.nil?
      raise "You must run the report first." 
    else
      @data
    end
  end
  
end
